package icu.zqyhdm.blog.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description 用户实体类
 * @Author lifu
 * @Date 2021/6/22 14:57
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("user")
@ApiModel(description = "用户信息")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "手机号")
    @TableField(value = "phone")
    private String phone;

    @ApiModelProperty(value = "微信openid")
    @TableField("openid")
    private String openid;

    @ApiModelProperty(value = "昵称")
    @TableField(value = "nick_name")
    private String nickName;

    @ApiModelProperty(value = "个性签名")
    @TableField(value = "autograph")
    private String autograph;

    @ApiModelProperty(value = "密码")
    @TableField(value = "password")
    @JsonIgnore//序列化为json时，属性不序列化
    private String password;

    @ApiModelProperty(value = "邮箱")
    @TableField(value = "email")
    private String email;

    @ApiModelProperty(value = "头像")
    @TableField(value = "img")
    private String img;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private Date createTime;

    @ApiModelProperty(value = "上次登录时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("login_time")
    private Date loginTime;

    @ApiModelProperty(value = "角色")
    @TableField(value = "role")
    private Integer role;

    @TableField(exist = false)
    private Map<String, Object> param;
}
